package com.buybuyyi.stylistcrm.order.helper;

import com.buybuyyi.stylistcrm.order.po.Consignee;
import stylistcrm.core.services.order.dto.ConsigneeDto;
import stylistcrm.core.services.order.dto.TransferOrderDto;
import stylistcrm.core.services.order.enums.EnumConsigneeStatus;

import java.util.Date;

/**
 * Created by cheny on 2016/9/24.
 */
public class ConsigneeHelper {

    /**
     * 获取收货人地址对象
     * @param consigneeDto
     * @return
     */
    public static Consignee getOrderConsignee(ConsigneeDto consigneeDto){
        if(null==consigneeDto){
            return null;
        }
        Consignee consignee=new Consignee();
        Integer consigneeId=consigneeDto.getConsigneeId();
        if(null!=consigneeId){
            consignee.setId(consigneeDto.getConsigneeId());
        }else{
            consignee.setCreateTime(new Date());
        }
        consignee.setModifyTime(new Date());
        consignee.setName(consigneeDto.getConsigneeName());
        consignee.setTelphone(consigneeDto.getConsigneeTel());
        consignee.setAddress(consigneeDto.getConsigneeAddress());
        consignee.setPostcode(consigneeDto.getConsigneePostcode());
        consignee.setStatus(EnumConsigneeStatus.DEFAULT.getCode());
        return consignee;
    }
}
